Skip to content

Make model catalog more compact#6

Merged
dzarlax merged 1 commit into
mainfrom
codex/compact-model-catalog
Jun 15, 2026
Merged

Make model catalog more compact#6
dzarlax merged 1 commit into
mainfrom
codex/compact-model-catalog

Conversation

@dzarlax

@dzarlax dzarlax commented Jun 15, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • Add cards as the default model catalog view and keep the sortable table as an audit view.
  • Add compact catalog toolbar with provider, view, filter, and sort controls.
  • Share model action controls between card and table modes and add template coverage.

Test Plan

  • go test -count=1 ./internal/adminapi
  • go test -count=1 ./...

Summary by CodeRabbit

  • New Features

    • Added view mode toggle to switch between card and table layouts when browsing models.
    • Models browser now supports responsive design with optimized layouts for smaller screens.
  • Tests

    • Added test coverage for card and table view rendering modes.
  • Style

    • Updated catalog styling for improved card layout and responsive mobile design.

@coderabbitai

coderabbitai Bot commented Jun 15, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@dzarlax, we couldn't start this review because you've reached your PR review rate limit.

More reviews will be available in 50 minutes and 27 seconds. Learn how PR review limits work.

Your organization has used up its prepaid credits, and credit purchases are no longer available. Enable the review add-on in the billing tab to keep reviews running — you're only billed for reviews past your plan's rate limits ($0.25/file).

⌛ How to resolve this issue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available.

Please see our Fair Usage Limits Policy for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 753b60da-c863-4caa-9ed1-57c2a27214e2

📥 Commits

Reviewing files that changed from the base of the PR and between 7404d70 and 03560c6.

📒 Files selected for processing (5)
  • internal/adminapi/adminapi_test.go
  • internal/adminapi/handlers.go
  • internal/adminapi/templates/partials_layout.html
  • internal/adminapi/templates/partials_models_browser.html
  • internal/adminapi/templates/partials_models_row.html
📝 Walkthrough

Walkthrough

Adds a view query parameter (cards/table) to the models browser. The handler reads it and stores it in uiFilters.View; templates conditionally render a new card-grid layout (models_cards, model_card) or the existing table layout; a shared model_actions template centralises HTMX override and slot-assign controls; new CSS supports the card layout and responsive breakpoints; a test verifies both render modes.

Changes

Models Browser Card/Table View Toggle

Layer / File(s) Summary
View mode field and query param wiring
internal/adminapi/handlers.go
uiFilters gains a View field; buildIndexData reads view from the query string (defaulting to "cards"), and assigns it in both the preset and manual filter browsing paths.
models_browser toolbar and models_content view switching
internal/adminapi/templates/partials_models_browser.html
Provider tab HTMX URLs now include view={{.Filters.View}}; a hidden view field is added to the filters form; models_content conditionally renders models_table or models_cards; models_table wrapper markup and tbody boundary are corrected.
Card templates and shared model_actions
internal/adminapi/templates/partials_models_row.html
Adds models_cards (grid/section-grouped), model_card (per-model card UI), and model_actions (HTMX override + slot-assign controls scoped to closest [data-model-card]); updates model_row to tag <tr data-model-card> and delegate to model_actions.
Catalog layout and responsive CSS
internal/adminapi/templates/partials_layout.html
Adds toolbar, tab, grid, card, metric-tile, and empty-state CSS; adds @media (max-width: 640px) overrides for single-column card layout and full-width controls.
Rendering test for card and table modes
internal/adminapi/adminapi_test.go
TestModelsBrowserRendersCardAndTableModes renders viewModelsBrowser in both modes and asserts presence/absence of mode-specific HTML markers.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

  • Dzarlax-AI/personal_assistant#5: Modifies the same model_row template in partials_models_row.html, overlapping directly with this PR's refactoring of row markup and actions.

Poem

🐇 A grid of cards, a table too,
The rabbit clicks and gets a view!
With view=table or view=cards,
Templates branch like rabbit yards.
HTMX hops closest [data-model-card],
And CSS makes them look quite starred! ✨

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'Make model catalog more compact' directly aligns with the PR's primary objective of improving the model catalog's compactness and usability through view modes, toolbar enhancements, and refactoring.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch codex/compact-model-catalog

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 7404d70309

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +22 to +26
hx-get="/models?full=1"
hx-target="#models-browser"
hx-swap="outerHTML"
hx-include="#models-filters"
hx-vals='{"view":"table"}'>Audit table</button>

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Preserve presets when toggling audit view

When this toggle is used from a role's Suggest results, the request is only /models?full=1 plus #models-filters; that form does not submit .Filters.ActivePreset, so buildIndexData leaves the preset path and rebuilds the ordinary catalog. The Audit table button therefore clears the recommendation banner/sections instead of showing the same suggested candidates in table mode; include the active preset in the submitted state when it is set.

Useful? React with 👍 / 👎.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🧹 Nitpick comments (1)
internal/adminapi/templates/partials_models_row.html (1)

62-62: 💤 Low value

Unused variable $modelID.

This variable is defined but never referenced within model_card. The model_actions template defines its own $modelID from .Model.ID. Consider removing this line to reduce noise.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@internal/adminapi/templates/partials_models_row.html` at line 62, The
variable assignment `$modelID := .ID` at line 62 in the partials_models_row.html
template is defined but never used within the model_card template block. Remove
this unused variable declaration to eliminate unnecessary code and reduce
template noise. The model_actions template handles its own modelID variable
definition from .Model.ID, so this declaration is redundant.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@internal/adminapi/adminapi_test.go`:
- Around line 212-223: In the "table audit" subtest, add negative assertions
after the existing check for "catalog-audit-table" to verify that card-related
markers are absent from the rendered HTML. This ensures that table mode and card
mode are mutually exclusive and prevents regressions where both modes could be
rendered simultaneously. Use strings.Contains with a negation check to assert
that card mode markers do not appear in the output when in table view mode.

In `@internal/adminapi/templates/partials_models_row.html`:
- Line 125: The hx-vals attribute at line 125 embeds {{$modelID}} directly into
a JSON string without proper escaping, which will break the JSON if the model ID
contains special characters like double quotes or backslashes. Fix this by
either using Go's JSON marshaling capabilities in the template to properly
escape the model_id value before embedding it in hx-vals, or by moving the
dynamic model_id value into hidden input fields within the HTML while keeping
only static values in the hx-vals attribute to ensure the JSON remains
well-formed regardless of model ID content.

---

Nitpick comments:
In `@internal/adminapi/templates/partials_models_row.html`:
- Line 62: The variable assignment `$modelID := .ID` at line 62 in the
partials_models_row.html template is defined but never used within the
model_card template block. Remove this unused variable declaration to eliminate
unnecessary code and reduce template noise. The model_actions template handles
its own modelID variable definition from .Model.ID, so this declaration is
redundant.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 3accfb2f-04b9-41a4-ac57-997a34a576a0

📥 Commits

Reviewing files that changed from the base of the PR and between 8a2fae8 and 7404d70.

📒 Files selected for processing (5)
  • internal/adminapi/adminapi_test.go
  • internal/adminapi/handlers.go
  • internal/adminapi/templates/partials_layout.html
  • internal/adminapi/templates/partials_models_browser.html
  • internal/adminapi/templates/partials_models_row.html

Comment thread internal/adminapi/adminapi_test.go
Comment thread internal/adminapi/templates/partials_models_row.html Outdated
@dzarlax dzarlax force-pushed the codex/compact-model-catalog branch from 7404d70 to 03560c6 Compare June 15, 2026 17:12
@dzarlax dzarlax merged commit d0360c7 into main Jun 15, 2026
6 checks passed
@dzarlax dzarlax deleted the codex/compact-model-catalog branch June 15, 2026 17:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant